#ifndef INFRAREDFEATURE_H
#define INFRAREDFEATURE_H

#include <QWidget>
#include <QTableWidget>
#include <QGroupBox>
#include <QVBoxLayout>
#include "tabframe/mapinfo/mapinfotab.h"
#include "infrared/infraredspectrum.h"

/**
 * @brief 红外特性组件
 * 处理红外图谱相关的数据显示
 */
class InfraredFeature : public QObject, public virtual IMapInfoFeature
{
    Q_OBJECT
public:
    explicit InfraredFeature(QObject* parent = nullptr);
    virtual ~InfraredFeature();

    // 从IMapInfoFeature接口
    QWidget* initUI(QWidget* parent) override;
    void loadFromSpectrum(DataSpecificationGW::Spectrum* spectrum) override;

    // 红外特有的方法
    void setTemperatureUnit(uint8_t unit);
    void setEmissivity(float emissivity);
    void setMaxTemperature(float maxTemp);
    void setMinTemperature(float minTemp);
    void setAverageTemperature(float avgTemp);
    void setCenterTemperature(float centerTemp);
    void setCenterTemperatureCompensation(float compensation);
    void setFocusLength(float length);
    void setInfraredImageData(const QByteArray& data);
    
    // 基础信息相关方法
    void setDataTypeCode(uint8_t code);
    void setDataLength(int32_t length);
    void setCreateTime(const QString& time);
    void setChartProperty(const DataSpecificationGW::SpectrumCharacter& property);
    void setDeviceName(const QString& name);
    void setDeviceCode(const QString& code);
    void setMeasurementName(const QString& name);
    void setMeasurementCode(const QString& code);
    void setChannelFlag(int64_t flag);
    void setDataType(uint8_t type);
    void setReservedData(const QByteArray& data);

private:
    QTableWidget* m_dataTable;
    QGroupBox* m_groupBox;
    QTableWidgetItem* createTableWidgetItem(const QString& text);

    // 数据成员
    uint8_t m_temperatureUnit;
    float m_emissivity;
    float m_maxTemperature;
    float m_minTemperature;
    float m_averageTemperature;
    float m_centerTemperature;
    float m_centerTemperatureCompensation;
    float m_focusLength;
    QByteArray m_infraredImageData;
    
    // 基础信息成员变量
    uint8_t m_dataTypeCode;
    int32_t m_dataLength;
    QString m_createTime;
    DataSpecificationGW::SpectrumCharacter m_chartProperty;
    QString m_deviceName;
    QString m_deviceCode;
    QString m_measurementName;
    QString m_measurementCode;
    int64_t m_channelFlag;
    uint8_t m_dataType;
    QByteArray m_reservedData;

    // 更新表格显示
    void updateTable();
};

#endif // INFRAREDFEATURE_H 